home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 2
/
AACD 2.iso
/
AACD
/
WebSites
/
MailingLists
/
AMOSLIST.0599
/
000020_nobody_Wed May 5 06:34:36 1999.msg
< prev
next >
Wrap
Internet Message Format
|
1999-06-01
|
2KB
Received: from onelist.com (pop.onelist.com [209.207.164.227])
by osf1.gmu.edu (8.8.8/8.8.8) with SMTP id GAA03311
for <mcox4@osf1.gmu.edu>; Wed, 5 May 1999 06:34:35 -0400 (EDT)
Received: (qmail 23491 invoked by alias); 5 May 1999 10:34:45 -0000
Received: (qmail 23415 invoked from network); 5 May 1999 10:34:43 -0000
Received: from unknown (HELO saintolaves.demon.co.uk) (195.99.45.122) by pop.onelist.com with SMTP; 5 May 1999 10:34:43 -0000
Date: Wed, 5 May 1999 11:38:55 EST
Message-Id: <199905051138.AA363331878@saintolaves.demon.co.uk>
From: <cheila@saintolaves.demon.co.uk>
X-Sender: <cheila@saintolaves.demon.co.uk>
To: amos-list@onelist.com
X-Mailer: <IMail v4.06>
Mailing-List: list amos-list@onelist.com; contact amos-list-owner@onelist.com
Delivered-To: mailing list amos-list@onelist.com
Precedence: bulk
List-Unsubscribe: <mailto:amos-list-unsubscribe@ONElist.com>
Reply-to: amos-list@onelist.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: Re: [amos-list] Crossing lines, fast.
Status: O
X-Status:
From: <cheila@saintolaves.demon.co.uk>
Hi
Here is a nice algorithm to check if line segments cross:
Input:
Line1: x0,y0 - x1,y1
Line2: u0,v0 - u1,v1
(with _1 >= _0)
Step 1: Check bounding boxes
if u0 > x1 then not cross
if u1 < x0 then not cross
if v0 > y1 then not cross
if v1 < y0 then not cross
Step 2: Check cross
line1: x = x1*t + (1-t)*x0, y = y1*t + (1-t)*y0
line2: x = u1*s + (1-s)*u0, y = v1*s + (1-s)*v0
solve for s, t (simultaneous equations, simple)
if 0 <= t <= 1 and 0 <= s <= 1 then cross
Step 3: Find intersection (may not be needed)
substitute t or s to find x, y
I think this is one of the best algorithms, but there may
be some more. There are more complicated versions for
polygons in 3D (if that's what you're doing).
Hope this helps
Claude
------------------------------------------------------------------------
Wanting to get back in touch with old friends?
http://www.onelist.com
Reunite through a ONElist community.
------------------------------------------------------------------------
Official AMOS WWW: http://members.xoom.com/AmosFactory/front.html